package com.moyun.zbmy.zizhou.ui.adapter.holder;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.moyun.zbmy.zizhou.R;
import com.moyun.zbmy.zizhou.application.Constances;
import com.moyun.zbmy.zizhou.base.BaseActivity;
import com.moyun.zbmy.zizhou.beans.HomeTopicItem;
import com.moyun.zbmy.zizhou.beans.NewAdvertisementBean;
import com.moyun.zbmy.zizhou.ui.activities.AdvertPicInfoActivity;
import com.moyun.zbmy.zizhou.ui.activities.H5NormalActivity;
import com.moyun.zbmy.zizhou.ui.activities.TopicDetailActivity;
import com.moyun.zbmy.zizhou.ui.utils.GlideUtil;
import com.ruihang.generalibrary.ui.widget.CustomEXImageView;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class NewSpecialHolder extends BaseAbsHolder<HomeTopicItem> {

    public boolean isMute = true;
    @BindView(R.id.item_special_title)
    protected CustomFontTextView specialTitle;
    @BindView(R.id.item_special_img)
    protected CustomEXImageView specialImg;


    private HomeTopicItem topicItem;

    public NewSpecialHolder(Context context, View itemView) {
        super(context, itemView);

    }

    public boolean isMute() {
        return isMute;
    }

    public void setMute(boolean mute) {
        isMute = mute;
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(HomeTopicItem a) {
        topicItem = a;
        GlideUtil.getGlideWithSmall169DefCenterCrop(context, a.getNewsImage()).into(specialImg);
        specialTitle.setText(a.getNewsTitle());
    }


    @OnClick({R.id.special_layout})
    public void itemClick(View view) {
        if (null != topicItem ) {
            //专题详情
            Intent intent = new Intent(context, TopicDetailActivity.class);
            intent.putExtra(BaseActivity.EX_URL, topicItem.getNewsUrl());
            intent.putExtra(Constances.IS_CITY_STATE, false);
            context.startActivity(intent);
        }

    }

}
